<!DOCTYPE html>
<html>
 <head>
  <title>
   Test PixieDust In-Development Features
  </title>
  <meta content="&#xA9;Copyright IBM Corporation 2018" name="copyright"/>
  <meta content="&#xA9;Copyright IBM Corporation 2018" name="DC.Rights.Owner"/>
  <meta content="&#xA9; Copyright IBM Corporation 2016, 2017, 2018" name="dcterms.rights"/>
  <meta content="2018-03-09" name="DC.date"/>
 </head>
 <body>
  <div>
   <h1>
    Test PixieDust In-Development Features
   </h1>
   <p>
    PixieDust provides several
    <a href="https://github.com/ibm-cds-labs/pixiedust/tree/master/tests">
     notebooks
    </a>
    that you can run to test and check stability of various features. Tests are maintained using
    <a href="https://travis-ci.org/ibm-cds-labs/pixiedust">
     Travis CI
    </a>
    .
   </p>
   <p>
    The test script,
    <a href="https://github.com/ibm-cds-labs/pixiedust/blob/master/tests/runPixiedustNotebooks.py">
     runPixiedustNotebooks.py
    </a>
    , runs whenever an update is pushed to the repository or a pull request is made. The test script runs through each of the notebooks in the
    <a href="https://github.com/ibm-cds-labs/pixiedust/tree/master/tests">
     tests
    </a>
    directory.
   </p>
   <div>
    <h1>
     Locally Running the Tests
    </h1>
    <div>
     <h2>
      Using VSCode
     </h2>
     <ol>
      <li>
       <p>
        Install the
        <a href="http://donjayamanne.github.io/pythonVSCode/">
         python extension
        </a>
        into VSCode
       </p>
      </li>
      <li>
       <p>
        Open the pixiedust repository/directory in VSCode
       </p>
      </li>
      <li>
       <p>
        Set the
        <strong>
         python.pythonPath
        </strong>
        in the
        <em>
         User Settings
        </em>
        of the VSCode Preferences to the appropriate location of your python directory
       </p>
      </li>
      <li>
       <p>
        From the Debug View, click on the Configure gear and select Python
       </p>
      </li>
      <li>
       <p>
        Edit the
        <code>
         launch.json
        </code>
        and add a new object (or edit an existing one) in
        <em>
         configurations
        </em>
       </p>
      </li>
     </ol>
     <pre>{
  "name": "pixiedust test",
  "type": "python",
  "request": "launch",
  "stopOnEntry": false,
  "pythonPath": "${config.python.pythonPath}",
  "program": "${workspaceRoot}/tests/runPixiedustNotebooks.py",
  "console": "integratedTerminal",
  "debugOptions": [
    "WaitOnAbnormalExit",
    "WaitOnNormalExit"
  ],
  "env": {
    "SPARK_HOME": "/Users/path/to/spark",
    "SCALA_HOME": "/Users/path/to/scala",
    "PIXIEDUST_TEST_INPUT": "${workspaceRoot}/tests"
  }
}</pre>
     <p>
      Update the
      <code>
       SPARK_HOME
      </code>
      and
      <code>
       SCALA_HOME
      </code>
      entries accordingly. If you want, update
      <code>
       PIXIEDUST_TEST_INPUT
      </code>
      to where test notebooks to run are located
     </p>
     <ol>
      <li>
       <p>
        Select the newly created or updated
        <strong>
         pixiedust test
        </strong>
        configuration from dropdown in the Debug view
       </p>
      </li>
      <li>
       <p>
        Click on the Debug green arrow, to run the configuration
       </p>
      </li>
     </ol>
     <p>
      The Integrated Terminal should show the test output as the tests are running.
     </p>
    </div>
    <div>
     <h2>
      Using Command Line
     </h2>
     <p>
      From a terminal window:
     </p>
     <ol>
      <li>
       <p>
        Go into the
        <code>
         tests
        </code>
        directory in the pixiedust repository/directory
       </p>
      </li>
      <li>
       <p>
        Set the following environment variables accordingly
       </p>
      </li>
     </ol>
     <pre>SPARK_HOME=/Users/path/to/spark
SCALA_HOME=/Users/path/to/scala
PIXIEDUST_TEST_INPUT=/Users/path/to/test/notebooks</pre>
     <ol>
      <li>
       <p>
        Run the command
        <code>
         python runPixiedustNotebooks.py
        </code>
       </p>
      </li>
     </ol>
     <p>
      The terminal window should show the test output as the tests are running.
     </p>
    </div>
   </div>
   <p>
    <h3>
     Return to main topic for:
    </h3>
    <ul>
     <li>
      <a href="develop.html">
       Develop for PixieDust
      </a>
     </li>
    </ul>
   </p>
  </div>
 </body>
</html>
